package cn.iocoder.yudao.module.dt.dal.mysql.activitywrite;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dt.dal.dataobject.activitywrite.ActivityWriteDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dt.controller.admin.activitywrite.vo.*;

/**
 * 活动核销记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ActivityWriteMapper extends BaseMapperX<ActivityWriteDO> {

    default PageResult<ActivityWriteDO> selectPage(ActivityWritePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityWriteDO>()
                .eqIfPresent(ActivityWriteDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ActivityWriteDO::getActivityAdminId, reqVO.getActivityAdminId())
                .eqIfPresent(ActivityWriteDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(ActivityWriteDO::getActivitySubmitId, reqVO.getActivitySubmitId())
                .betweenIfPresent(ActivityWriteDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityWriteDO::getId));
    }

    default List<ActivityWriteDO> selectList(ActivityWriteExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ActivityWriteDO>()
                .eqIfPresent(ActivityWriteDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ActivityWriteDO::getActivityAdminId, reqVO.getActivityAdminId())
                .eqIfPresent(ActivityWriteDO::getActivityId, reqVO.getActivityId())
                .eqIfPresent(ActivityWriteDO::getActivitySubmitId, reqVO.getActivitySubmitId())
                .betweenIfPresent(ActivityWriteDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityWriteDO::getId));
    }

}
